package com.qcq.es.Controller;

import com.qcq.es.entity.PageResult;
import com.qcq.es.entity.QueryPageBean;
import com.qcq.es.entity.Result;
import com.qcq.es.service.GoodsService;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：qcq
 * @date ：Created in 2020/11/23 22:53
 * @description：
 */
@RestController
public class GoodsController {

    @Autowired
    private GoodsService goodsService;


    @PostMapping("good/search")
    public Result search(@RequestBody QueryPageBean queryPageBean) {
        return new Result(goodsService.search(queryPageBean));
    }

    /*@GetMapping("good/search/{currentPage}/{pageSize}/{keyword}")
//    public Result search(@PathVariable("currentPage") Integer  currentPage,@PathVariable("pageSize") Integer  pageSize,@PathVariable("keyword") String  keyword) {
    public Result search(@PathVariable("currentPage") Integer  currentPage,@PathVariable("pageSize") Integer  pageSize,@PathVariable("keyword") String  keyword) {
        return new Result(goodsService.search(currentPage,pageSize,keyword));
    }
*/
   /* @GetMapping("good/search/{currentPage}/{pageSize}")
    public Result search(@PathVariable("currentPage") Integer  currentPage,@PathVariable("pageSize") Integer  pageSize) {
        PageResult result = goodsService.search(currentPage, pageSize);
        System.out.println(result);
        return new Result(result);
    }*/


}
